// -----------------------------
// Author: 		Dhaenens Gert	
// Creation: 	3/6/2015 8:26:20 PM				
// -----------------------------

#include "AutoLock.h"

namespace Flow
{

	AutoLock::AutoLock(IMutex* lpMutex)
		: m_lpMutex(lpMutex)
	{
		ASSERT(m_lpMutex);
		m_lpMutex->Lock();
	}

	AutoLock::AutoLock(const AutoLock& refAutoLock)
		: m_lpMutex(refAutoLock.m_lpMutex)
	{
	}

	AutoLock& AutoLock::operator=(const AutoLock& refAutoLock)
	{
		m_lpMutex = refAutoLock.m_lpMutex;
		return (*this);
	}

	AutoLock::~AutoLock()
	{
		m_lpMutex->Unlock();
	}

}